import {Svg} from 'react-native-svg';
import {View} from 'react-native';
import {IconProps} from './types';

export const SvgCommon = (props: IconProps) => {
  const {scale = 1, children, isCommon, isLarge, ...rest} = props;

  if (isLarge) {
    return (
      <View style={{transform: `scale(${scale})`, position: 'absolute'}}>
        <Svg
          width="107"
          height="108"
          viewBox="0 0 107 108"
          fill="none"
          translateY={scale ? -(2 - (scale as number)) * 108 : 0}>
          {children}
        </Svg>
      </View>
    );
  }

  return (
    <View style={{transform: `scale(${scale || 1})`}}>
      {isCommon ? (
        <Svg width="48" height="48" viewBox="0 0 48 48" fill="none" {...rest}>
          {children}
        </Svg>
      ) : (
        <Svg width="24" height="24" viewBox="0 0 24 24" fill="none" {...rest}>
          {children}
        </Svg>
      )}
    </View>
  );
};
